namespace xgui
{
	%nodefault;
	%feature("docstring","**DESCRIPTION**\n\nThis class contains a set of static functions that can be used to create and manage all the other XGui objects.\n\n**METHODS**\n\n") Master;
	class Master
	{
		public:
		    %feature("docstring","returns the current instance of the Master class or creates a new instance if it does not exist yet.\n\n*C++*:: 

 ") Istance;
			static xgui::Master * Instance();
			%feature("docstring","exits XGui main event loop started with the Run() method.\n\n*C++*:: static void Quit();\n\n") Quit;
			static void Quit();
			%feature("docstring","register a callback funtion that will be executed after the main event loop has finished processing currently pending events.\n<wid> will be passed as a parameter to the callback function.\n\n*C++*::\n\n static void RegisterIdleCallback ( xgui::Callback * cbk, xgui::Widget * wid )\n\n") RegisterIdleCallback;
			static void RegisterIdleCallback ( xgui::Callback * cbk, xgui::Widget * wid );

            %feature("docstring","initializes the dynamic class environment.\n\n*C++*::\n\n static void InitDynamicClasses();") InitDynamicClasses;
			static void InitDynamicClasses();

            %feature("docstring","creates a new model to be used in widgets derived from the View class.\n\n*C++*::\n\n static xgui::Model * CreateModel();\n\n") CreateModel;
			static xgui::Model * CreateModel();
			%feature("docstring","destroyes the specified model. If the model is assigned to some views it's not destroyed.\n\n*C++*::\n\n static void DestroyModel(xgui::Model * model)\n\n") DestroyModel;
			static void DestroyModel(xgui::Model * model);

            %feature("docstring","creates a new StyleManager object that is responsible of holding the visual styles of styled items.\n\n*C++*::\n\n static xgui::StyleManager * CreateStyleManager();\n\n") CreateStyleManager;
			static xgui::StyleManager * CreateStyleManager();
			%feature("docstring","destroyes a StyleManager object.\n\n*C++*::\n\n static void DestroyStyleManager(xgui::StyleManager * sm);\n\n") DestroyStyleManager;
			static void DestroyStyleManager(xgui::StyleManager * sm);
			
			#ifdef SWIGPYTHON
				%typemap(out) xgui::Object * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Window * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Button * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Label * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Entry * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::VBox * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::HBox * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::ImageView * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::List * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Toolbar * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Combobox * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Space * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Checkbox * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Progressbar * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Slider * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Menu * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Tab * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Spin * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Frame * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Calendar * { $result = XGUIPyObjectCreate($1, true); }
				%typemap(out) xgui::Tree * { $result = XGUIPyObjectCreate($1, true); }
			#endif
			
			%feature("docstring","loads an image from the specified file and returns an xgui::Image object that represents it.\nIf the specified file has already benn loaded then the same Image object is returned.\n\n*C++*::\n\n static xgui::Image * LoadImage(std::string const &path);\n\n") LoadImage;
			static xgui::Image * LoadImage(std::string const &path);
			%feature("docstring","returns a pointer to an Image object of an already loaded image, or NULL if the specified image file\nis not loaded.\n\n*C++*::\n\n static xgui::Image * GetImage(std::string const &path);\n\n") GetImage;
			static xgui::Image * GetImage(std::string const &path);
			%feature("docstring","returns a pointer to an Image object that does not represents a real image. It is used when a function argument\nrequires an Image object reference.\n\n*C++*::\n\n static xgui::Image * NullImage();\n\n") NullImage;
			static xgui::Image * NullImage();

            %feature("docstring","returns the context (usually a top-level window) with the specified id.\n\n*C++*::\n\n static xgui::Window * FindContext(std::string const &cname);\n\n") FindContext;
			static xgui::Window * FindContext(std::string const &cname);
			%feature("docstring","creates a new Window widget and returns a pointer to it.\nIf <parent> is specified then a modal window is created.\n\n*C++*::\n\n static xgui::Window * CreateWindow(xgui::Window * parent = 0);\n\n") CreateWindow;
			static xgui::Window * CreateWindow(xgui::Window * parent = 0);
			%feature("docstring","creates a new Button widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<text> is the text displayed on the button.If <image> is specified, then the image is displayed on the button.If <toggle_button> is true then a toggle button is created: a toggle button maintains its pressed/unpressed position as the user clicks on it.\n\n*C++*::\n\n static xgui::Button * CreateButton(xgui::Container * parent, std::string const &text, xgui::Image * image = 0, bool toggle_button = false); \n\n") CreateButton;
			static xgui::Button * CreateButton(xgui::Container * parent, std::string const &text, xgui::Image * image = 0, bool toggle_button = false);
			%feature("docstring","creates a new Label widget and returns a pointer to it.\nThe newly created widget is inserted as a child of the <parent> container.\n<text> is the text displayed in the label.\n\n*C++*::\n\n static xgui::Label * CreateLabel(xgui::Container * parent, std::string const &text);\n\n") CreateLabel;
			static xgui::Label * CreateLabel(xgui::Container * parent, std::string const &text);
			%feature("docstring","creates a new Entry widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<text> specifies the text initially displayed in the entry.<maxlen> is the maximum length in characters of inserted text in the entry.If <editable> is false then the text in the entry widget is read-only.If <password_mode> is true then an asterisk is displayed for each character typed in by the user.\n\n*C++*::\n\n static xgui::Entry * CreateEntry(xgui::Container * parent, std::string const &text, int maxlen=0, bool editable=true, bool password_mode=false);\n\n") CreateEntry;
			static xgui::Entry * CreateEntry(xgui::Container * parent, std::string const &text, int maxlen=0, bool editable=true, bool password_mode=false);
			%feature("docstring","creates a new VBox widget and returns a pointer to it.\nThe newly created widget is inserted as a child of the <parent> container.\n<space> specifies the space in pixels to be left as a margin.\nIf <border> is set to true a 3d border is displayed around the widget.\n\n*C++*::\n\n static xgui::VBox * CreateVBox(xgui::Container * parent, int space = 0, bool border = false);\n\n") CreateVBox;
			static xgui::VBox * CreateVBox(xgui::Container * parent, int space = 0, bool border = false);
			%feature("docstring","creates a new HBox widget and returns a pointer to it.\nThe newly created widget is inserted as a child of the <parent> container.\n<space> specifies the space in pixels to be left as a margin.\nIf <border> is set to true a 3d border is displayed around the widget.\n\n*C++*::\n\n static xgui::HBox * CreateHBox(xgui::Container * parent, int space = 0, bool border = false);\n\n") CreateHBox;
			static xgui::HBox * CreateHBox(xgui::Container * parent, int space = 0, bool border = false);
			%feature("docstring","creates a new Calendar widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<img> is the image to be displayed in the ImageView.\n\n*C++*::\n\n static xgui::ImageView * CreateImageView(xgui::Container * parent, xgui::Image * img = 0);\n\n") CreateImageView;
			static xgui::ImageView * CreateImageView(xgui::Container * parent, xgui::Image * img = 0);
			%feature("docstring","creates a new List widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<sm> is an optional pointer to a StyleManager object that defines the visual styles of list items.\n\n*C++*::\n\n static xgui::List * CreateList(xgui::Container * parent);\n\n") CreateList;
 			static xgui::List * CreateList(xgui::Container * parent);
 			%feature("docstring","creates a new Toolbar widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.\n\n*C++*::\n\n static xgui::Toolbar * CreateToolbar(xgui::Container * parent);\n\n") CreateToolbar;
			static xgui::Toolbar * CreateToolbar(xgui::Container * parent);
			%feature("docstring","creates a new Combobox widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.If <editable> is true then the entry part of the combobox can be manually edited (i.e.: text can be manually changed).\n\n*C++*::\n\n static xgui::Combobox * CreateCombobox(xgui::Container * parent, bool editable = 0);\n\n") CreateCombobox;
			static xgui::Combobox * CreateCombobox(xgui::Container * parent, bool editable = 0);
			%feature("docstring","creates a new Space widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<min_width> and <min_height> specifiy the minimum dimensions of the space widget.\n\n*C++*::\n\n static xgui::Space * CreateSpace(xgui::Container * parent, int width = 1, int height = 1);\n\n ") CreateSpace;
			static xgui::Space * CreateSpace(xgui::Container * parent, int width = 1, int height = 1);
			%feature("docstring","creates a new Checkbox widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<text> is the text displayed near the checkbox..\n\n*C++*::\n\n static xgui::Checkbox * CreateCheckbox(xgui::Container * parent, std::string const &text); \n\n") CreateCheckbox;
			static xgui::Checkbox * CreateCheckbox(xgui::Container * parent, std::string const &text);
			%feature("docstring","creates a new Calendar widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<min> is the minimum progressbar counter value.<max> is the maximum progressbar counter value.\n\n*C++*::\n\n static xgui::Progressbar * CreateProgressbar(xgui::Container * parent, int min = 0, int max = 100); \n\n") CreateProgressbar;
			static xgui::Progressbar * CreateProgressbar(xgui::Container * parent, int min = 0, int max = 100);
			%feature("docstring","creates a new Slider widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<min> is the minimum position of the slider.<max> is the maximum position of the slider.If <vertical> is true the slider can be moved vertically, otherwise horizonatlly.\n\n*C++*::\n\n static xgui::Slider * CreateSlider(xgui::Container * parent, int min = 0, int max = 100, bool vertical = false);\n\n") CreateSlider;
			static xgui::Slider * CreateSlider(xgui::Container * parent, int min = 0, int max = 100, bool vertical = false);
			%feature("docstring","creates a new Menu widget and returns a pointer to it.The newly created widget is inserted as a childof the <parent> container.If <visible> is false the menu is initially hidden.\n\n*C++*::\n\n static xgui::Menu * CreateMenu(xgui::Window * parent, bool visible = true ); \n\n") CreateMenu;
			static xgui::Menu * CreateMenu(xgui::Window * parent, bool visible = true );
			%feature("docstring","creates a new Tab widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<alignment> specifies where the tab labels are displayed. It can be one of the following: *\"top\", \"left\", \"right\", \"bottom\"* \n\n*C++*::\n\n static xgui::Tab * CreateTab(xgui::Container * parent, const std::string & alignment = \"top\");\n\n") CreateTab;
			static xgui::Tab * CreateTab(xgui::Container * parent, const std::string & alignment = "top");
			%feature("docstring","creates a new Spin widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<min> is the minimum value.<max> is the maximum value.\n\n*C++*::\n\n static xgui::Spin * CreateSpin(xgui::Container * parent, int min = 0, int max = 100); \n\n") CreateSpin;
			static xgui::Spin * CreateSpin(xgui::Container * parent, int min = 0, int max = 100);
			%feature("docstring","creates a new Frame widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<label> is the text displayed on the frame top border.\n\n*C++*::\n\n static xgui::Frame * CreateFrame(xgui::Container * parent, const std::string & label);\n\n") CreateFrame;
			static xgui::Frame * CreateFrame(xgui::Container * parent, const std::string & label);
			%feature("docstring","creates a new Calendar widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.\n\n*C++*::\n\n static xgui::Calendar * CreateCalendar(xgui::Container * parent); \n\n") CreateCalendar;
			static xgui::Calendar * CreateCalendar(xgui::Container * parent);
			%feature("docstring","creates a new Tree widget and returns a pointer to it.The newly created widget is inserted as a child of the <parent> container.<sm> is an optional pointer to a StyleManager object that defines the visual styles of tree items.\n\n*C++*::\n\n static xgui::Tree * CreateTree(xgui::Container * parent); \n\n") CreateTree;
			static xgui::Tree * CreateTree(xgui::Container * parent);
			
			%feature("docstring","loads an XML file representing a structure of XGui widgets and returns the root object of the hierarchy.<parent> is the object that will contain the loaded object.\n\n*C++*::\n\n static xgui::Object * LoadXml(const std::string & file_name);\n\n") LoadXml;
			static xgui::Object * LoadXml(const std::string & file_name);
			
			%clear xgui::Object *;
			%clear xgui::Calendar *;
			%clear xgui::Window *;
			%clear xgui::Button *;
			%clear xgui::Label *;
			%clear xgui::Entry *;
			%clear xgui::VBox *;
			%clear xgui::HBox *;
			%clear xgui::ImageView *;
			%clear xgui::List *;
			%clear xgui::Toolbar *;
			%clear xgui::Combobox *;
			%clear xgui::Space *;
			%clear xgui::Checkbox *;
			%clear xgui::Progressbar *;
			%clear xgui::Slider *;
			%clear xgui::Menu *;
			%clear xgui::Tab *;
			%clear xgui::Spin *;
			%clear xgui::Frame *;
			%clear xgui::Tree *;

            %feature("docstring","destroys the specified widget removing it from its parent container.\n\n*C++*::\n\n static void DestroyWidget(xgui::Widget * w);\n\n") DestroyWidget;
			static void DestroyWidget(xgui::Widget * w);
			
	};
	%makedefault;
}

%extend xgui::Master
{
    %feature("docstring","initializes the XGui threading environment. This function should be called on application startup.\n\n*C++*::\n\n static void InitThreads()\n\n") InitThreads;
	static void InitThreads()
	{
		xgui::Master::InitThreads();
	}
	
	%feature("docstring","terminates the XGui threading environment. This function should be called on application cleanup.\n\n*C++*::\n\n xgui::Master::QuitThreads();\n\n") QuitThreads;
	static void QuitThreads()
	{
	%#ifdef WIN32
		TlsFree(PythonThreadsManager::tls_index);
	%#endif
		xgui::Master::QuitThreads();
	}

    %feature("docstring","enable Ctrl::Lock in the application\n\n*C++*::\n\n static void GuiLock()\n\n") GuiLock;
	static void GuiLock()
	{
		Py_BEGIN_ALLOW_THREADS
		xgui::Master::GuiLock();
		Py_END_ALLOW_THREADS
	}
    
    %feature("docstring","disable Ctrl::Lock in the applicationn\n\n*C++*::\n\n static void GuiUnlock()\n\n") GuiUnlock;
	static void GuiUnlock()
	{
		Py_BEGIN_ALLOW_THREADS
		xgui::Master::GuiUnlock();
		Py_END_ALLOW_THREADS
	}

    %feature("docstring","enters the main XGui event loop.\n\n*C++*::\n\n static int Run()\n\n") Run;
	static int Run()
	{
		PythonThreadsManager::AllowThreads();
		xgui::Master::Run();
		PythonThreadsManager::DenyThreads();
		return 0;
	}
	
	%feature("docstring","opens a common requester for opening a file.<parent> is the the window over which the dialog will be displayed; it can be NULL.<filter> is a vector of xgui::FileExtension structures that specifies the list of file types that the dialog will display.<title> is the dialog window title.<path> is an optional path that represents the directory in which the dialog opens.<multiselection> can be true to allow the selection of multiple files.\n\nThe return value is a vector of strings that represents the list of selected files with full paths.\n\n*C++*::\n\n static std::vector<std::string> OpenFileDialog(xgui::Window * parent,const std::vector<xgui::FileExtension> &filter,std::string const &title,std::string const &path=\"\",bool multiselection = false)\n\n") OpenFileDialog;
	static std::vector<std::string> OpenFileDialog(xgui::Window * parent, const std::vector<xgui::FileExtension> &filter, std::string const &title, std::string const &path = "", bool multiselection = false)
	{
		std::vector<std::string> retval;
		
		Py_BEGIN_ALLOW_THREADS
		retval = xgui::Master::OpenFileDialog(parent, filter, title, path, multiselection);
		Py_END_ALLOW_THREADS
		
		return retval;
	}
	
	%feature("docstring","opens a common requester for saving a file.<parent> is the the window over which the dialog will be displayed; it can be NULL.<filter> is a vector of xgui::FileExtension structures that specifies the list of file types that the dialog will display.<title> is the dialog window title.<path> is an optional path that represents the directory in which the dialog opens.<file_name> is an optional name of a file initially proposed by the dialog as a save file name.\n\nThe return value is the file name with full path of the selected file.") SaveFileDialog;
	static std::string SaveFileDialog(xgui::Window * parent, const std::vector<xgui::FileExtension> &filter, std::string const &title, std::string const &path = "", std::string const &file_name = "")
	{
		std::string retval;
		
		Py_BEGIN_ALLOW_THREADS
		retval = xgui::Master::SaveFileDialog(parent, filter, title, path, file_name);
		Py_END_ALLOW_THREADS
		
		return retval;
	}
	
	%feature("docstring","opens a common dialog for displaying a message text.<parent> is the the window over which the dialog will be displayed; it can be NULL.<title> is the dialog window title.<text> is the text that the dialog should display.<type> is a class for the message severity and can be one of the follwing strings: *\"warn\", \"question\", \"err\"* and *\"info\"* .<buttons> determines what buttons are displayed in the dialog; it can be one of the following: *\"ok\", \"ok-cancel\", \"yes-no\", \"yes-no-cancel\"* ") MessageDialog;
	static int MessageDialog(xgui::Window * parent, const std::string & title, const std::string & text, const std::string & type = "info", const std::string & buttons = "ok" )
	{
		int retval;
		
		Py_BEGIN_ALLOW_THREADS
		retval = xgui::Master::MessageDialog(parent, title, text, type, buttons);
		Py_END_ALLOW_THREADS
		
		return retval;
	}
}
